<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>文档中心</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}"/>
    <link rel="stylesheet" th:href="@{/admin/css/pearForm.css}"/>
    <link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
    <link rel="stylesheet" th:href="@{/admin/css/fangge-style.css}"/>
    <link rel="stylesheet" th:href="@{/admin/css/doc-common.css}"/>
    <link rel="stylesheet" th:href="@{/admin/css/nav.css}"/>
    <link rel="stylesheet" th:href="@{/admin/css/pear-tree/dtree.css}"/>
    <link rel="stylesheet" th:href="@{/admin/css/pear-tree/font/dtreefont.css}"/>
</head>
<body>
<div class="layui-row" style="width: 100%">
    <ul class="layui-nav layui-bg-green" id="navigation" lay-filter="test">
        <li class="layui-nav-item">
            <a href="/restdoc/project/view"> <i class="layui-icon layui-icon-return"
                                                style="font-size: 17px;  color: white;"></i>&nbsp;</a>
        </li>
        <li class="layui-nav-item layui-this"><a id="home" th:href="@{'/'+${projectId}+'/document/nav/view'}">文档</a>
        </li>
        <li class="layui-nav-item"><a id="clientServiceList" href="javascript:;">服务实例
            <span class="layui-badge-dot" th:if="${hasInstance}"></span>
        </a>
        </li>
        <li class="layui-nav-item"><a id="projectSettings" href="javascript:;">设置
        </a>
        </li>
    </ul>
</div>

<input type="hidden" id="projectId" th:value="${projectId}">

<div class="layui-fluid">
    <iframe src="" id="docContentFrame" frameborder="0" style="width: 100%;height: 1000px;">
    </iframe>
</div>
<script th:src="@{/layui/layui.js}"></script>
<script th:src="@{/admin/js/jquery.js}"></script>
<script th:src="@{/admin/js/util.js}"></script>

<script>

    layui.config({
        base: '/restdoc/layui/lay/extends/'
    }).use([
        'util',
        'layer',
        'element',
        'jquery',
        'tree'], function () {
        var tree = layui.tree;
        var $ = layui.jquery;
        var layer = layui.layer;
        var element = layui.element;
        var treeData = null;
        var projectId = $("#projectId").val();

        $("#docContentFrame").attr("src", "/restdoc/project/" + projectId + "/navigation/view");

        element.on('nav(test)', function (elem) {
            if ('clientServiceList' === elem[0].id) {
                layer.closeAll();
                $("#docContentFrame").attr("src", '/restdoc/microservice/view/list?ap=REST_WEB&projectId=' + projectId);
            } else if ('projectSettings' === elem[0].id) {
                $("#docContentFrame").attr("src", '/restdoc/project/' + projectId + '/settings/view');
            }
        });
    });
    $('#restweb-project-nav').addClass("layui-this");
</script>
</body>
</html>